import user from '../Services/modules/userService.js';
import storage from '../buildIn/storage.js';
import mock from '../mock/mock.js';

var config = {
    timeout: 16000,
    isTest: false, //process.moduleLoadList ? true : false,
    imageHost: 'http://hrjr.tencentclound.com/',
    getRequestHost() {
        const env = getAppConfig().env;
        var host = '';
        if (env == 'dev') {
            host =
                'http://hrjr.tencentclound.com/api';
        } else if (env == 'pro') {
            host = 'http://hrjr.tencentclound.com/api';
        } else if (env == 'test') {
            host = 'http://hrjr.tencentclound.com/api';
        }
        return host;
    },
    getToken() {
        var token = user.getToken();

        return token;
    },
    getRequestHeader() {

        let token = this.getToken();
        let header = {};

        if (token) {
            header.Authorization = "Bearer " + token;
            header.token = token;
        }
        // var push_token = storage.get('push_token');
        // if (push_token) {
        // 	header.token = push_token;
        // }

        // 添加等待
        // loading.start();

        // console.log(header);

        return header;
    },
    errorMap() {

        return [];
    },
}

export default config